<template>
  <div>
    <el-table id="table"
              :data="this.apply"
              stripe
              height="600px"
              style="width: 100%">
      <el-table-column prop="id"
                       label="用户id"
                       align="center">
      </el-table-column>
      <el-table-column prop="account"
                       label="用户名"
                       align="center">
      </el-table-column>
      <el-table-column prop="status"
                       label="同意"
                       align="center">
        <!-- 作用域插槽 -->
        <template slot-scope="td">
          <el-button type="success"
                     icon="el-icon-check"
                     @click="agree(td.row)"
                     circle></el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import axios from '../../../axios_config';
import Commons from '../../../js/commons'

let apply = new Array();
export default {
  props: {
    // apply: {},//用来接收父组件传过来的数据
  },
  data () {
    return {
      apply: apply
    }
  },
  mounted () {
    axios.get("http://192.168.11.18:8080/user/findApply").then(res => {
      this.apply = res.data.data;
      this.$emit("findAapply", res.data.data.length);
    })
  },
  methods: {
    agree (row) {
      axios.get("http://192.168.11.18:8080/user/agreeApply?id=" + row.id).then(res => {
        this.apply = res.data.data;
        this.$emit("findAapply", res.data.data.length);
      });
    }
  },
}
</script>
<style scoped>
</style>